// Initial File - Paul Jack

#ifndef __COMMDEV_H__
#define __COMMDEV_H__

#include <qstring.h>
#include <qobject.h>
#include <qvariant.h>

class QByteArray;


class CommDevice : public QObject
{

    Q_OBJECT

public:

    CommDevice()
    {
        mAlternateSetting = 0;
        mInterfaceNum = 0;
        mProductId = 0;
        mVendorId = 0;
        mIdentification = "DefaultDevice";
        mDescription = "DefaultDescription";
    }

    // We don't know what type of device it's going to be so
    // We'll just keep this generic.
    void * mhDevice;

    // Here are the generic data types we want everyone to implement.
    quint32     mVendorId;
    quint32     mProductId;
    quint32     mInterfaceNum;
    quint32     mAlternateSetting;
    QString     mIdn;
    QString     mIdentification;
    QString     mDescription;

    QString     mLastKey;
    QVariant    mLastValue;



    // Here are the generic functions everyone must implement!
    virtual bool write(const QByteArray &strs) = 0;
    virtual bool readBulk(QByteArray &array) = 0;
    virtual bool read(QByteArray &str) = 0;
    virtual bool isConnected (void) = 0;
    virtual void setConnected(bool) = 0;
    virtual void initialize( void ) = 0;
    virtual quint32 getReadBulkErrorCode( void ){ return 0; };
    virtual quint32 getReadErrorCode( void ){ return 0; };
    virtual quint32 getWriteErrorCode( void ){ return 0; };


public slots:
    virtual void connected(){};
    virtual void disconnected(){};
    virtual void readyRead(){};


protected:

    bool mConnected;

};

#endif // __COMMDEV_H__
